package com.edu.dgut.dao;

import com.edu.dgut.entity.dailysalesEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

public interface dailysalesRepository extends JpaRepository<dailysalesEntity,String> {

    //获取全部日销售额并排序
    @Query("select d from dailysalesEntity d ORDER BY d.date ASC")
    List<dailysalesEntity> findAll();

    //通过日期查询销售额
    List<dailysalesEntity> findByDate(String date);

    //插入或修改销售额
    dailysalesEntity save(dailysalesEntity dailysales);

    //通过日期删除销售额
    @Transactional
    int deleteByDate(String date);
}
